<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>展示ajax请求京东某个商品展示价格</title>
		<script src="../../js/jquery.min.js"></script>
	</head>
	<body>
		<div id="rtnData"></div>
		<div id="itemPrice"></div>
		<div id="itemId"></div>
	</body>
	<script>
		$().ready(function(){
		//1.发起ajax请求
			$.ajax({
				type:"POST",
				url:"https://p.3.cn/prices/mgets",
				contentType: "application/json;charset=utf8",
				data: {		//拼接的参数
								"skuIds":"J_100007851351"
							},
				dataType:"jsonp",	
						success:function(data){
							$("#rtnData").text("返回结果"+JSON.stringify(data));//js对象转json字符串
							$("#itemPrice").html("商品价格：<font color=\"red\">"+data[0].p+"</font>");
							$("#itemId").text("商品编号："+data[0].id.substring(2));
						},
						error:function(){
							alert("请求失败，请联系管理员");
						}

			});
		
		});
	</script>
</html>
